<template>
  <div class="mine">
    <my-header></my-header>

    <!-- 登录box -->
    <!-- 未登录 -->
    <div class="loginbox glass" v-if="!userInfo">
      <h2>
        <span class="username1" @click="gotowhere('login')">立即登录</span>
      </h2>
      <div class="tool">
        <span class="more1">登录了解更多！</span>
      </div>
    </div>

    <!-- 已登录 -->
    <div class="loginbox glass" v-else style="background: none">
      <img src="@/assets/images/hutao.png" alt="" class="img" />
      <h2>
        <span class="username2" style="color: #000">{{ userInfo.phone }}</span>
      </h2>
      <div class="tool">
        <span class="more2" style="color: #000">欢迎你！</span>
      </div>
    </div>

    <!-- grid -->
    <div class="gridwrap mt20">
      <van-cell-group v-if="userInfo">
        <van-cell title="我的点赞" icon="like-o" @click="gotowhere('mylike')" />
        <van-cell
          title="我的评论"
          icon="comment-o"
          @click="gotowhere('mycomment')"
        />
        <van-cell
          title="修改密码"
          icon="passed"
          @click="gotowhere('changepwd')"
        />
        <van-cell title="找回密码" icon="question-o" />
        <van-cell title="设置" icon="setting-o" />
        <van-cell title="客服帮助" icon="manager-o" />
        <van-cell title="清除缓存" icon="location-o" />
        <van-cell title="退出登陆" icon="location-o" @click="exitLogin" />
      </van-cell-group>
      <van-cell-group v-else>
        <van-cell title="设置" icon="setting-o" />
        <van-cell title="客服帮助" icon="location-o" />
        <van-cell title="清除缓存" icon="location-o" />
      </van-cell-group>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    exitLogin() {
      this.$dialog
        .confirm({
          title: "你好",
          message: "确认要退出登录吗？",
        })
        .then(() => {
          this.changeUserInfo(null);
        })
        .catch(() => {});
    },
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.mine {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  // align-items: center;
  // justify-content: space-between;
  padding: 15px 15px;
  .loginbox {
    width: 100%;
    height: 100px;
    margin-top: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #ff80aa;
    .username2 {
      color: #fff;
    }
    .more2 {
      color: #eee;
      font-size: 12px;
    }
    img {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      position: absolute;
      top: 0;
      transform: translateY(-50%);
      border: 4px solid #ff80aa;
    }
    h2 {
      margin-top: 20px;
    }
  }
  .gridwrap {
    ::v-deep .van-grid-item {
      // background: #e680ff;
      color: #ff80aa;
      border: 1px solid;
    }
    ::v-deep .van-button {
      margin-top: 30px;
    }
  }
}
</style>